<?php
	class Shop_model extends CI_Model {
		public function __construct()
		{
			$this->load->database();
		}
		
		public function get_shop($id = FALSE)
		{
			if ($id === FALSE)
			{
				$query = $this->db->get('shop');
				return $query->result_array();
			}
	
			$query = $this->db->get_where('shop', array('id' => $id));
			return $query->row_array();
		}
		
		public function set_shop()
		{			
			$data = array(
				'shop_name' => $this->input->post('shop_name'),
				'web_url' => $this->input->post('web_url'),
				'phone' => $this->input->post('phone'),
				'phone_mobile' => $this->input->post('phone_mobile'),
				'email' => $this->input->post('email'),
				'contact_person' => $this->input->post('contact_person'),
				'acc_username' => $this->input->post('acc_username'),
				'acc_password' => $this->input->post('acc_password'),
				'acc_status' => $this->input->post('acc_status')
			);
	
			return $this->db->insert('shop', $data);
		}
		
		public function delete($id){
			$this->db->delete('shop', array('id' => $id)); 
		}
	}	
?>		